/*
 * @Author: kennencool 3304192108@qq.com
 * @Date: 2024-06-07 09:39:59
 * @LastEditors: kennencool 3304192108@qq.com
 * @LastEditTime: 2024-06-07 09:48:14
 * @FilePath: \compute\include\manager.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

typedef struct DeviceInfo_st {
	char DeviceName[16];
	char DeviceSerialNum[16];
	char HardwareVersion[4];
	char SoftwareVersion[4];
	char PrimaryFactoryInformation[40];
	char PrimaryFactoryDate[20];
	unsigned int  FactorySettingFlag;
	unsigned int  InitFlag;
	unsigned int  KeyIndex;
	unsigned int  KeKeyIndex;
	unsigned int  FhePriKeyIndex;
	unsigned int  AmdKeyIndex;
	unsigned int  GlbProKey;
}DEVICEINFO;


typedef struct UserInfo_st {
	char UserFactoryInformation[40];
	char UserFactoryDate[20];
}USERINFO;


int FHEKmg_Restore_FactorySetting(unsigned char * pucAdmPassword, unsigned int uiAdmPasswordLength, char* primaryFactoryInformation, char* primaryFactoryDate);


int FHEKmg_Get_DeviceInfo(
    unsigned char* pucAdmPassword, 
    unsigned int uiAdmPasswordLength,
    char* DeviceName,
    char* DeviceSerialNum,
    char* HardwareVersion,
    char* SoftwareVersion,
    char* primaryFactoryInformation,
    char* primaryFactoryDate
);

int FHEKmg_Init_UserInfo(
    unsigned char* pucAdmPassword,
    unsigned int uiAdmPasswordLength,
    char* userFactoryInformation,
    char* userFactoryDate
);

int FHEKmg_Get_UserInfo(
    unsigned char* pucAdmPassword,
    unsigned int uiAdmPasswordLength,
    char* userFactoryInformation,
    char* userFactoryDate
);

int FHEKmg_Init_Device(unsigned char* pucAdmPassword, unsigned int uiAdmPasswordLength);

int FHEKmg_Verification(unsigned char* pucAdmPassword, unsigned int uiAdmPasswordLength);

int FHEKmg_UnVerification();

int FHEKmg_Backup_DeviceKeyPair(unsigned char* pucAdmPassword, unsigned int uiAdmPasswordLength, char* device_keypair_str);

int FHEKmg_Restore_DeviceKeyPair(unsigned char* pucAdmPassword, unsigned int uiAdmPasswordLength, char* device_keypair_str);

int FHEKmg_Backup_ProKey(unsigned char* pucAdmPassword, unsigned int uiAdmPasswordLength, char* prokey_str);

int FHEKmg_Restore_ProKey(unsigned char* pucAdmPassword, unsigned int uiAdmPasswordLength, char* prokey_str);

int FHEKmg_Update_KeyMngerPassword(unsigned char* pucOldPassword, unsigned int uiOldPwdLength, unsigned char* pucNewPassword, unsigned int uiNewPwdLength);